home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume6 / rpc2 / part01 next >
Encoding:
Internet Message Format  |  1986-11-30  |  50.6 KB

  1. Subject:  v06i089:  Sun RPC Source (rpc2), Part01/11
  2. Newsgroups: mod.sources
  3. Approved: rs@mirror.UUCP
  4.  
  5. Submitted by: sun!ferne!marks (Mark Stein)
  6. Mod.sources: Volume 6, Issue 89
  7. Archive-name: rpc2/Part01
  8.  
  9. [  All I did was very that the shar files were complete. --r$  ]
  10.  
  11. Sun RPC source (part 1 of 11).  This software package contains code
  12. and documentation for Revision 3.0 of the Sun Remote Procedure Call
  13. library.  In addition, a beta version of the XDR/RPC protocol compiler
  14. is included.  Comments about this latest release may be mailed to
  15. sun!rpc or rpc@sun.com.
  16.  
  17. Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  18. unrestricted use provided that this legend is included on all tape
  19. media and as a part of the software program in whole or part.  Users
  20. may copy or modify Sun RPC without charge, but are not authorized to
  21. license or distribute it to anyone else except as part of a product or
  22. program developed by the user.
  23.  
  24. - - - - - - - - - C U T - H E R E - - - - - - - - - - - - - - - - - -
  25. #! /bin/sh
  26. # This is a shell archive, meaning:
  27. # 1. Remove everything above the #! /bin/sh line.
  28. # 2. Save the resulting text in a file.
  29. # 3. Execute the file with /bin/sh (not csh) to create:
  30. #    rpc/README
  31. #    rpc/Files
  32. #    rpc/doc/README
  33. #    rpc/doc/rpc.spec
  34. #    rpc/doc/runoff
  35. #    rpc/doc/runoff.troff
  36. #    rpc/doc/sunhead.ms
  37. #    rpc/tools/rpcinfo.8
  38. #    rpc/tools/rpcinfo.c
  39. #    rpc/toys/Makefile
  40. #    rpc/toys/sort_prot.c
  41. #    rpc/toys/sort_prot.h
  42. #    rpc/toys/sort_service.c
  43. #    rpc/toys/sortit.c
  44. #    rpc/rpclib/Makefile
  45. # This archive created: Mon Jul 14 16:54:49 1986
  46. export PATH; PATH=/bin:/usr/bin:$PATH
  47. for d in rpc rpc/doc rpc/rpclib rpc/tools rpc/toys rpc/rpclib/profiled rpc/rpcgen rpc/rpcgen/test
  48. do
  49.     if test ! -d $d
  50.     then
  51.         echo "shar: Making directory $d"
  52.         mkdir $d
  53.         chmod 755 $d
  54.     fi
  55. done
  56. echo shar: "extracting 'rpc/README'" '(1555 characters)'
  57. if test -f 'rpc/README'
  58. then
  59.     echo shar: "will not over-write existing file 'rpc/README'"
  60. else
  61. sed 's/^X//' << \SHAR_EOF > 'rpc/README'
  62. XJuly 14, 1986
  63. X
  64. XThis directory contains the public domain Sun rpc/xdr code.  There
  65. Xare several subdirectories:
  66. X
  67. X    doc    Rpc/xdr documentation in .ms format.  See doc/README
  68. X        for more information.
  69. X
  70. X    rpclib    The rpc/xdr library source code.  At Sun, RPC is part
  71. X        of the C library (libc.a).  This makefile will make a
  72. X        library called rpclib.
  73. X
  74. X    tools    Two source files and their manual pages.
  75. X
  76. X        portmap.c is the source to /etc/portmap, the rpc
  77. X        daemon which must be started by root before any other
  78. X        rpc servers or clients.
  79. X
  80. X        rpcinfo.c dumps the information that portmap keeps.
  81. X        At Sun, it lives in /usr/etc/rpcinfo.
  82. X
  83. X        Both source files assume the the rpc dot-h files
  84. X        have been installed in /usr/include.
  85. X
  86. X    toys    Source to a toy sort service which can be used to test
  87. X        out the rpc/xdr library.
  88. X
  89. X    rpcgen    The RPC protocol compiler.  See the README file.
  90. X
  91. X
  92. XThe rpc/xdr library was built with a post-1.1 Sun release of the
  93. Xcompiler.  Old compilers complain about valid C.  You can make old
  94. Xcompilers happy by changing some voids to ints.  However, the fix to
  95. Xthe 4.2 VAX compiler is as follows:
  96. X
  97. Xtrees.c:
  98. X
  99. Xremoved spurious type mismatch errors in expressions involving
  100. Xpointers to void functions, e.g., void foo(){...} void (*f)() = foo;
  101. X
  102. X1250c1264,1266
  103. X<         else if( mt12 == 0 ) break;
  104. X---
  105. X>         /* if right is TVOID and looks like a CALL, is not ok */
  106. X>         else if (mt2 == 0 && (p->in.right->in.op == CALL || p->in.right->in.op == UNARY CALL))
  107. X>             break;
  108. X
  109. X
  110. XNetwork Services Consulting
  111. XMS 2-33
  112. XSun Microsystems, Inc
  113. X2550 Garcia Avenue
  114. XMountain View, CA  94043
  115. SHAR_EOF
  116. if test 1555 -ne "`wc -c < 'rpc/README'`"
  117. then
  118.     echo shar: "error transmitting 'rpc/README'" '(should have been 1555 characters)'
  119. fi
  120. chmod 644 'rpc/README'
  121. fi
  122. echo shar: "extracting 'rpc/Files'" '(1688 characters)'
  123. if test -f 'rpc/Files'
  124. then
  125.     echo shar: "will not over-write existing file 'rpc/Files'"
  126. else
  127. sed 's/^X//' << \SHAR_EOF > 'rpc/Files'
  128. Xrpc/README
  129. Xrpc/Files
  130. X
  131. Xrpc/doc/README
  132. Xrpc/doc/rpc.spec
  133. Xrpc/doc/rpc.prog.p1
  134. Xrpc/doc/rpc.prog.p2
  135. Xrpc/doc/xdr.spec.p2
  136. Xrpc/doc/xdr.spec.p1
  137. Xrpc/doc/runoff
  138. Xrpc/doc/runoff.troff
  139. Xrpc/doc/sunhead.ms
  140. X
  141. Xrpc/tools/rpcinfo.8
  142. Xrpc/tools/rpcinfo.c
  143. Xrpc/tools/portmap.8c
  144. Xrpc/tools/portmap.c
  145. X
  146. Xrpc/toys/Makefile
  147. Xrpc/toys/sort_prot.c
  148. Xrpc/toys/sort_prot.h
  149. Xrpc/toys/sort_service.c
  150. Xrpc/toys/sortit.c
  151. X
  152. Xrpc/rpclib/Makefile
  153. Xrpc/rpclib/profiled
  154. Xrpc/rpclib/auth.h
  155. Xrpc/rpclib/auth_unix.h
  156. Xrpc/rpclib/clnt.h
  157. Xrpc/rpclib/pmap_clnt.h
  158. Xrpc/rpclib/pmap_prot.h
  159. Xrpc/rpclib/rpc.h
  160. Xrpc/rpclib/rpc_msg.h
  161. Xrpc/rpclib/svc.h
  162. Xrpc/rpclib/svc_auth.h
  163. Xrpc/rpclib/types.h
  164. Xrpc/rpclib/xdr.h
  165. Xrpc/rpclib/auth_none.c
  166. Xrpc/rpclib/auth_unix.c
  167. Xrpc/rpclib/authunix_prot.c
  168. Xrpc/rpclib/clnt_perror.c
  169. Xrpc/rpclib/clnt_raw.c
  170. Xrpc/rpclib/clnt_simple.c
  171. Xrpc/rpclib/clnt_tcp.c
  172. Xrpc/rpclib/clnt_udp.c
  173. Xrpc/rpclib/pmap_clnt.c
  174. Xrpc/rpclib/pmap_getmaps.c
  175. Xrpc/rpclib/pmap_getport.c
  176. Xrpc/rpclib/pmap_prot.c
  177. Xrpc/rpclib/pmap_rmt.c
  178. Xrpc/rpclib/rpc_prot.c
  179. Xrpc/rpclib/svc.c
  180. Xrpc/rpclib/svc_auth.c
  181. Xrpc/rpclib/svc_auth_unix.c
  182. Xrpc/rpclib/svc_raw.c
  183. Xrpc/rpclib/svc_simple.c
  184. Xrpc/rpclib/svc_tcp.c
  185. Xrpc/rpclib/svc_udp.c
  186. Xrpc/rpclib/xdr.c
  187. Xrpc/rpclib/xdr_array.c
  188. Xrpc/rpclib/xdr_float.c
  189. Xrpc/rpclib/xdr_mem.c
  190. Xrpc/rpclib/xdr_rec.c
  191. Xrpc/rpclib/xdr_reference.c
  192. Xrpc/rpclib/xdr_stdio.c
  193. X
  194. Xrpc/rpcgen/Makefile
  195. Xrpc/rpcgen/README
  196. Xrpc/rpcgen/rpc_cout.c
  197. Xrpc/rpcgen/rpc_hout.c
  198. Xrpc/rpcgen/rpc_main.c
  199. Xrpc/rpcgen/rpc_parse.c
  200. Xrpc/rpcgen/rpc_parse.h
  201. Xrpc/rpcgen/rpc_scan.c
  202. Xrpc/rpcgen/rpc_scan.h
  203. Xrpc/rpcgen/rpc_svcout.c
  204. Xrpc/rpcgen/rpc_util.c
  205. Xrpc/rpcgen/rpc_util.h
  206. Xrpc/rpcgen/rpcgen.1
  207. Xrpc/rpcgen/xdr_update.c
  208. X
  209. Xrpc/rpcgen/test/Makefile
  210. Xrpc/rpcgen/test/demo_clnt.c
  211. Xrpc/rpcgen/test/demo_proc.c
  212. Xrpc/rpcgen/test/demo_xdr.x
  213. SHAR_EOF
  214. if test 1688 -ne "`wc -c < 'rpc/Files'`"
  215. then
  216.     echo shar: "error transmitting 'rpc/Files'" '(should have been 1688 characters)'
  217. fi
  218. chmod 664 'rpc/Files'
  219. fi
  220. echo shar: "extracting 'rpc/doc/README'" '(341 characters)'
  221. if test -f 'rpc/doc/README'
  222. then
  223.     echo shar: "will not over-write existing file 'rpc/doc/README'"
  224. else
  225. sed 's/^X//' << \SHAR_EOF > 'rpc/doc/README'
  226. XThis directory contains three documents of interest:
  227. X
  228. X    rpc.prog: RPC Programming Guide
  229. X    rpc.spec: RPC Protocol Specification
  230. X    xdr.spec: XDR Specification
  231. X
  232. XFormatting procedures for nroff are in the shell script runoff.
  233. XRunoff.troff uses troff, and assumes you have ditroff and pic.  Some
  234. Xextenstions to -ms are in the macro file sunhead.ms.
  235. SHAR_EOF
  236. if test 341 -ne "`wc -c < 'rpc/doc/README'`"
  237. then
  238.     echo shar: "error transmitting 'rpc/doc/README'" '(should have been 341 characters)'
  239. fi
  240. chmod 444 'rpc/doc/README'
  241. fi
  242. echo shar: "extracting 'rpc/doc/rpc.spec'" '(23693 characters)'
  243. if test -f 'rpc/doc/rpc.spec'
  244. then
  245.     echo shar: "will not over-write existing file 'rpc/doc/rpc.spec'"
  246. else
  247. sed 's/^X//' << \SHAR_EOF > 'rpc/doc/rpc.spec'
  248. X.PL RIGHT
  249. X.TL
  250. XRemote Procedure Call
  251. X.br
  252. XProtocol Specification
  253. X.bp
  254. X.NH
  255. XIntroduction
  256. X.LP
  257. XThis document specifies a message protocol used in implementing
  258. XSun's Remote Procedure Call (RPC) package.
  259. XThe message protocol is specified with the
  260. XeXternal Data Representation (XDR) language.
  261. X.LP
  262. XThis document assumes that the reader is familiar with both RPC and XDR.
  263. XIt does not attempt to justify RPC or its uses.
  264. XAlso, the casual user of RPC does not need to be
  265. Xfamiliar with the information in this document.
  266. X.NH 2
  267. XTerminology
  268. X.LP
  269. XThe document discusses servers, services,
  270. Xprograms, procedures, clients and versions.
  271. XA server is a machine where some number
  272. Xof network services are implemented.
  273. XA service is a collection of one or more remote programs.
  274. XA remote program implements one or more remote procedures;
  275. Xthe procedures, their parameters and results are documented
  276. Xin the specific program's protocol specification.
  277. XNetwork clients are pieces of software that initiate
  278. Xremote procedure calls to services.
  279. XA server may support more than one version of a remote program
  280. Xin order to be forward compatible with changing protocols.
  281. X.LP
  282. XFor example, a network file service may be composed of two programs.
  283. XOne program may deal with high level applications
  284. Xsuch as file system access control and locking.
  285. XThe other may deal with low-level file I/O,
  286. Xand have procedures like ``read'' and ``write''.
  287. XA client machine of the network file service would call
  288. Xthe procedures associated with the two programs of the service
  289. Xon behalf of some user on the client machine.
  290. X.NH 2
  291. XThe RPC Model
  292. X.LP
  293. XThe remote procedure call model is similar to
  294. Xthe local procedure call model.
  295. XIn the local case, the caller places arguments to a procedure
  296. Xin some well-specified location (such as a result register).
  297. XIt then transfers control to the procedure,
  298. Xand eventually gains back control.
  299. XAt that point, the results of the procedure
  300. Xare extracted from the well-specified location,
  301. Xand the caller continues execution.
  302. X.LP
  303. XThe remote procedure call is similar,
  304. Xexcept that one thread of control winds through two processes \(em
  305. Xone is the caller's process,
  306. Xthe other is a server's process.
  307. XThat is, the caller process sends a call message
  308. Xto the server process and waits (blocks) for a reply message.
  309. XThe call message contains the procedure's parameters,
  310. Xamong other things.
  311. XThe reply message contains the procedure's results,
  312. Xamong other things.
  313. XOnce the reply message is received,
  314. Xthe results of the procedure are extracted,
  315. Xand caller's execution is resumed.
  316. X.LP
  317. XOn the server side,
  318. Xa process is dormant awaiting the arrival of a call message.
  319. XWhen one arrives the server process extracts the procedure's parameters,
  320. Xcomputes the results, sends a reply message,
  321. Xand then awaits the next call message.
  322. XNote that in this model,
  323. Xonly one of the two processes is active at any given time.
  324. XThat is, the RPC protocol does not explicitly support
  325. Xmulti-threading of caller or server processes.
  326. X.NH 2
  327. XTransports and Semantics
  328. X.LP
  329. XThe RPC protocol is independent of transport protocols.
  330. XThat is, RPC does not care how a message is passed
  331. Xfrom one process to another.
  332. XThe protocol only deals with
  333. Xthe specification and interpretation of messages.
  334. X.LP
  335. XBecause of transport independence,
  336. Xthe RPC protocol does not attach specific semantics
  337. Xto the remote procedures or their execution.
  338. XSome semantics can be inferred from
  339. X(but should be explicitly specified by)
  340. Xthe underlying transport protocol.
  341. XFor example, RPC message passing using UDP/IP is unreliable.
  342. XThus, if the caller retransmits call messages after short time-outs,
  343. Xthe only thing he can infer from no reply message
  344. Xis that the remote procedure was executed
  345. Xzero or more times (and from a reply message, one or more times).
  346. XOn the other hand, RPC message passing using TCP/IP is reliable.
  347. XNo reply message means that the remote procedure was executed at most once,
  348. Xwhereas a reply message means that the remote procedure was exactly once.
  349. X(Note:
  350. XAt Sun, RPC is currently implemented
  351. Xon top of TCP/IP and UDP/IP transports.)
  352. X.NH 2
  353. XBinding and Rendezvous Independence
  354. X.LP
  355. XThe act of binding a client to a service is
  356. X.I not
  357. Xpart of the remote procedure call specification.
  358. XThis important and necessary function
  359. Xis left up to some higher level software.
  360. X.LP
  361. XImplementors should think of the RPC protocol as the
  362. Xjump-subroutine instruction (``JSR'') of a network;
  363. Xthe loader (binder) makes JSR useful,
  364. Xand the loader itself uses JSR to accomplish its task.
  365. XLikewise, the network makes RPC useful,
  366. Xusing RPC to accomplish this task.
  367. X.NH 2
  368. XMessage Authentication
  369. X.LP
  370. XThe RPC protocol provides the fields necessary for a client to
  371. Xidentify himself to a service and vice versa.
  372. XSecurity and access control mechanisms
  373. Xcan be built on top of the message authentication.
  374. X.bp
  375. X.NH
  376. XRPC Protocol Requirements
  377. X.LP
  378. XThe RPC protocol must provide for the following:
  379. X.IP 1.
  380. XUnique specification of a procedure to be called.
  381. X.IP 2.
  382. XProvisions for matching response messages to request messages.
  383. X.IP 3.
  384. XProvisions for authenticating the caller to service and vice versa.
  385. X.LP
  386. XBesides these requirements,
  387. Xfeatures that detect the following are worth supporting
  388. Xbecause of protocol roll-over errors, implementation bugs,
  389. Xuser error, and network administration:
  390. X.IP 1.
  391. XRPC protocol mismatches.
  392. X.IP 2.
  393. XRemote program protocol version mismatches.
  394. X.IP 3.
  395. XProtocol errors (such as misspecification of a procedure's parameters).
  396. X.IP 4.
  397. XReasons why remote authentication failed.
  398. X.IP 5.
  399. XAny other reasons why the desired procedure was not called.
  400. X.LP
  401. X.NH 2
  402. XRemote Programs and Procedures
  403. X.LP
  404. XThe RPC call message has three unsigned fields:
  405. Xremote program number,
  406. Xremote program version number,
  407. Xand remote procedure number.
  408. XThe three fields uniquely identify the procedure to be called.
  409. XProgram numbers are administered by some central authority (like Sun).
  410. XOnce an implementor has a program
  411. Xnumber, he can implement his remote program;
  412. Xthe first implementation would
  413. Xmost likely have the version number of 1.
  414. XBecause most new protocols evolve into better,
  415. Xstable and mature protocols,
  416. Xa version field of the call message identifies which version
  417. Xof the protocol the caller is using.
  418. XVersion numbers make speaking old and new protocols
  419. Xthrough the same server process possible.
  420. X.LP
  421. XThe procedure number identifies the procedure to be called.
  422. XThese numbers are documented in
  423. Xthe specific program's protocol specification.
  424. XFor example, a file service's protocol specification
  425. Xmay state that its procedure number 5 is
  426. X.LW read
  427. Xand procedure number 12 is
  428. X.LW write .
  429. X.LP
  430. XJust as remote program protocols may change over several versions,
  431. Xthe actual RPC message protocol could also change.
  432. XTherefore, the call message also has the RPC version number in it;
  433. Xthis field must be two (2).
  434. X.LP
  435. XThe reply message to a request message has enough information
  436. Xto distinguish the following error conditions:
  437. X.IP 1.
  438. XThe remote implementation of RPC does speak protocol version 2.  The
  439. Xlowest and highest supported RPC version numbers are returned.
  440. X.IP 2.
  441. XThe remote program is not available on the remote system.
  442. X.IP 3.
  443. XThe remote program does not support the requested version number.
  444. XThe lowest and highest supported
  445. Xremote program version numbers are returned.
  446. X.IP 4.
  447. XThe requested procedure number does not exist
  448. X(this is usually a caller side protocol or programming error).
  449. X.IP 5.
  450. XThe parameters to the remote procedure
  451. Xappear to be garbage from the server's point of view.
  452. X(Again, this is caused by a disagreement about the
  453. Xprotocol between client and service.)
  454. X.NH 2
  455. XAuthentication
  456. X.LP
  457. XProvisions for authentication of caller to service and vice versa are
  458. Xprovided as a wart on the side of the RPC protocol.  The call message
  459. Xhas two authentication fields, the credentials and verifier.
  460. XThe reply message has one authentication field,
  461. Xthe response verifier.
  462. XThe RPC protocol specification defines all three fields
  463. Xto be the following opaque type:
  464. X.BS
  465. X.LS
  466. Xenum auth_flavor {
  467. X    AUTH_NULL    = 0,
  468. X    AUTH_UNIX    = 1,
  469. X    AUTH_SHORT    = 2
  470. X    /* and more to be defined */
  471. X};
  472. X.sp.5
  473. Xstruct opaque_auth {
  474. X    union switch (enum auth_flavor) {
  475. X        default: string auth_body<400>;
  476. X    };
  477. X};
  478. X.Lf
  479. X.BE
  480. XIn simple English, any
  481. X.LW opaque_auth
  482. Xstructure is an
  483. X.LW auth_flavor
  484. Xenumeration followed by a counted string,
  485. Xwhose bytes are opaque to the RPC protocol implementation.
  486. X.LP
  487. XThe interpretation and semantics of the data contained
  488. Xwithin the authentication fields is specified by individual,
  489. Xindependent authentication protocol specifications.
  490. XAppendix A defines three authentication protocols.
  491. X.LP
  492. XIf authentication parameters were rejected,
  493. Xthe response message contains information stating
  494. Xwhy they were rejected.
  495. X.NH 2
  496. XProgram Number Assignment
  497. X.LP
  498. XProgram numbers are given out in groups of 0x20000000 (536870912)
  499. Xaccording to the following chart:
  500. X.BS
  501. X.LS
  502. X       0 - 1fffffff    defined by Sun
  503. X20000000 - 3fffffff    defined by user
  504. X40000000 - 5fffffff    transient
  505. X60000000 - 7fffffff    reserved
  506. X80000000 - 9fffffff    reserved
  507. Xa0000000 - bfffffff    reserved
  508. Xc0000000 - dfffffff    reserved
  509. Xe0000000 - ffffffff    reserved
  510. X.Lf
  511. X.BE
  512. XThe first group is a range of numbers administered by Sun Microsystems,
  513. Xand should be identical for all Sun customers.  The second range
  514. Xis for applications peculiar to a particular customer.
  515. XThis range is intended primarily for debugging new programs.
  516. XWhen a customer develops an application that might be of general
  517. Xinterest, that application should be given an assigned number
  518. Xin the first range.  The third group is for applications that
  519. Xgenerate program numbers dynamically.  The final groups
  520. Xare reservered for future use, and should not be used.
  521. X.NH 2
  522. XOther Uses of the RPC Protocol
  523. X.LP
  524. XThe intended use of this protocol is for calling remote procedures.
  525. XThat is, each call message is matched with a response message.
  526. XHowever, the protocol itself is a message passing protocol
  527. Xwith which other (non-RPC) protocols can be implemented.
  528. XSun currently uses, or perhaps abuses,
  529. Xthe RPC message protocol for the following two (non-RPC) protocols:
  530. Xbatching (or pipelining) and broadcast RPC.
  531. XThese two protocols are discussed but not defined below.
  532. X.NH 3
  533. XBatching
  534. X.LP
  535. XBatching allows a client to send an arbitrarily large sequence
  536. Xof call messages to a server;
  537. Xbatching uses reliable bytes stream protocols (like TCP/IP)
  538. Xfor their transport.
  539. XIn the case of batching, the client never waits for a reply
  540. Xfrom the server and the server does not send replies to batch requests.
  541. XA sequence of batch calls is usually terminated by a legitimate
  542. XRPC in order to flush the pipeline (with positive acknowledgement).
  543. X.NH 3
  544. XBroadcast RPC
  545. X.LP
  546. XIn broadcast RPC based protocols,
  547. Xthe client sends an a broadcast packet to
  548. Xthe network and waits for numerous replies.
  549. XBroadcast RPC uses unreliable, packet based protocols (like UDP/IP)
  550. Xas their transports.
  551. XServers that support broadcast protocols only respond
  552. Xwhen the request is successfully processed,
  553. Xand are silent in the face of errors.
  554. X.de NE
  555. X.br
  556. X.ne 1i
  557. X..
  558. X.bp
  559. X.NH
  560. XThe RPC Message Protocol
  561. X.LP
  562. XThis section defines the RPC message protocol in the XDR data description
  563. Xlanguage.  The message is defined in a top down style.
  564. XNote: This is an XDR specification, not C code.
  565. X.BS
  566. X.LS no
  567. Xenum msg_type {
  568. X    CALL = 0,
  569. X    REPLY = 1
  570. X};
  571. X.sp.5
  572. X.NE
  573. X/*
  574. X * A reply to a call message can take on two forms:
  575. X * the message was either accepted or rejected.
  576. X */
  577. Xenum reply_stat {
  578. X    MSG_ACCEPTED = 0,
  579. X    MSG_DENIED = 1
  580. X};
  581. X.sp.5
  582. X.NE
  583. X/*
  584. X * Given that a call message was accepted, the following is
  585. X * the status of an attempt to call a remote procedure.
  586. X */
  587. Xenum accept_stat {
  588. X    SUCCESS = 0,      /* RPC executed successfully */
  589. X    PROG_UNAVAIL = 1, /* remote hasn't exported program */
  590. X    PROG_MISMATCH= 2, /* remote can't support version # */
  591. X    PROC_UNAVAIL = 3, /* program can't support procedure */
  592. X    GARBAGE_ARGS = 4  /* procedure can't decode params */
  593. X};
  594. X.sp.5
  595. X.NE
  596. X/*
  597. X * Reasons why a call message was rejected:
  598. X */
  599. Xenum reject_stat {
  600. X    RPC_MISMATCH = 0, /* RPC version number != 2 */
  601. X    AUTH_ERROR = 1    /* remote can't authenticate caller */
  602. X};
  603. X.sp.5
  604. X.NE
  605. X/*
  606. X * Why authentication failed:
  607. X */
  608. Xenum auth_stat {
  609. X    AUTH_BADCRED = 1,    /* bad credentials (seal broken) */
  610. X    AUTH_REJECTEDCRED=2, /* client must begin new session */
  611. X    AUTH_BADVERF = 3,    /* bad verifier (seal broken) */
  612. X    AUTH_REJECTEDVERF=4, /* verifier expired or replayed */
  613. X    AUTH_TOOWEAK = 5,    /* rejected for security reasons */
  614. X};
  615. X.sp.5
  616. X.NE
  617. X/*
  618. X * The RPC message:
  619. X * All messages start with a transaction identifier, xid,
  620. X * followed by a two-armed discriminated union.  The union's
  621. X * discriminant is a msg_type which switches to one of the
  622. X * two types of the message.  The xid of a REPLY message
  623. X * always matches that of the initiating CALL message.  NB:
  624. X * The xid field is only used for clients matching reply
  625. X * messages with call messages; the service side cannot
  626. X * treat this id as any type of sequence number.
  627. X */
  628. Xstruct rpc_msg {
  629. X    unsigned    xid;
  630. X    union switch (enum msg_type) {
  631. X        CALL:    struct call_body;
  632. X        REPLY:    struct reply_body;
  633. X    };
  634. X};
  635. X.sp.5
  636. X.NE
  637. X/*
  638. X * Body of an RPC request call:
  639. X * In version 2 of the RPC protocol specification, rpcvers
  640. X * must be equal to 2.  The fields prog, vers, and proc
  641. X * specify the remote program, its version number, and the
  642. X * procedure within the remote program to be called.  After
  643. X * these fields are two  authentication parameters: cred
  644. X * (authentication credentials) and verf (authentication
  645. X * verifier).  The two  authentication parameters are
  646. X * followed by the parameters to the remote procedure,
  647. X * which are specified by the specific program protocol.
  648. X */
  649. Xstruct call_body {
  650. X    unsigned rpcvers;    /* must be equal to two (2) */
  651. X    unsigned prog;
  652. X    unsigned vers;
  653. X    unsigned proc;
  654. X    struct opaque_auth cred;
  655. X    struct opaque_auth verf;
  656. X    /* procedure specific parameters start here */
  657. X};
  658. X.sp.5
  659. X.NE
  660. X/*
  661. X * Body of a reply to an RPC request.
  662. X * The call message was either accepted or rejected.
  663. X */
  664. Xstruct reply_body {
  665. X    union switch (enum reply_stat) {
  666. X        MSG_ACCEPTED:    struct accepted_reply;
  667. X        MSG_DENIED:    struct rejected_reply;
  668. X    };
  669. X};
  670. X.sp.5
  671. X.NE
  672. X/*
  673. X * Reply to an RPC request that was accepted by the server.
  674. X * Note: there could be an error even though the reques
  675. X * was accepted.  The first field is an authentication
  676. X * verifier that the server generates in order to validate
  677. X * itself to the caller.  It is followed by a union whose
  678. X * discriminant is an enum accept_stat.  The SUCCESS arm
  679. X * of the union is protocol specific.  The PROG_UNAVAIL,
  680. X * PROC_UNAVAIL, and GARBAGE_ARGS arms of the union are
  681. X * void.  The PROG_MISMATCH arm specifies the lowest and
  682. X * highest version numbers of the remote program that are
  683. X * supported by the server.
  684. X */
  685. Xstruct accepted_reply {
  686. X    struct opaque_auth    verf;
  687. X    union switch (enum accept_stat) {
  688. X        SUCCESS: struct {
  689. X            /*
  690. X             * procedure-specific results start here
  691. X             */
  692. X        };
  693. X        PROG_MISMATCH: struct {
  694. X            unsigned low;
  695. X            unsigned  high;
  696. X        };
  697. X        default: struct {
  698. X            /*
  699. X             * void. Cases include PROG_UNAVAIL,
  700. X             * PROC_UNAVAIL, and GARBAGE_ARGS.
  701. X             */
  702. X        };
  703. X    };
  704. X};
  705. X.sp.5
  706. X.NE
  707. X/*
  708. X * Reply to an RPC request that was rejected by the server.
  709. X * The request can be rejected because of two reasons:
  710. X * either the server is not running a compatible version of
  711. X * the RPC protocol (RPC_MISMATCH), or the server refuses
  712. X * to authenticate the caller (AUTH_ERROR).  In the case of
  713. X * an RPC version mismatch, the server returns the lowest
  714. X * and highest supported RPC version numbers.  In the case
  715. X * of refused authentication, failure status is returned.
  716. X */
  717. Xstruct rejected_reply {
  718. X    union switch (enum reject_stat) {
  719. X        RPC_MISMATCH: struct {
  720. X            unsigned low;
  721. X            unsigned high;
  722. X        };
  723. X        AUTH_ERROR: enum auth_stat;
  724. X    };
  725. X};
  726. X.Lf
  727. X.BE
  728. X.NH 2
  729. XAuthentication Parameter Specification
  730. X.LP
  731. XAs previously stated, authentication parameters are opaque,
  732. Xbut open-ended to the rest of the
  733. XRPC protocol.  This section defines some ``flavors'' of authentication
  734. Xwhich have been implemented at (and supported by) Sun.
  735. X.NH 3
  736. XNull Authentication
  737. X.LP
  738. XOften calls must be made where the caller does not know who he is and
  739. Xthe server does not care who the caller is.  In this case, the auth_flavor value
  740. X(the discriminant of the opaque_auth's union) of the
  741. XRPC message's credentials, verifier, and response verifier is
  742. X.LW AUTH_NULL
  743. X(0).
  744. XThe bytes of the auth_body string are undefined.
  745. XIt is recommended that the string length be zero.
  746. X.NH 3
  747. XUNIX Authentication
  748. X.LP
  749. XThe caller of a remote procedure may wish to identify himself as he is
  750. Xidentified on a
  751. X.UX
  752. Xsystem.
  753. XThe value of the
  754. X.LW credential 's
  755. Xdiscriminant of
  756. Xan RPC call message is
  757. X.LW AUTH_UNIX
  758. X(1).  The bytes of the
  759. X.LW credential 's
  760. Xstring encode the the following (XDR) structure:
  761. X.BS
  762. X.LS
  763. Xstruct auth_unix {
  764. X    unsigned    stamp;
  765. X    string        machinename<255>;
  766. X    unsigned    uid;
  767. X    unsigned    gid;
  768. X    unsigned    gids<10>;
  769. X};
  770. X.Lf
  771. X.BE
  772. XThe
  773. X.LW stamp
  774. Xis an arbitrary id which the caller machine may generate.
  775. XThe
  776. X.LW machinename
  777. Xis the name of the caller's machine (like ``krypton'').
  778. XThe
  779. X.LW uid
  780. Xis the caller's effective user id.
  781. XThe
  782. X.LW gid
  783. Xis the callers effective group id.
  784. XThe
  785. X.LW gids
  786. Xis a counted array of groups
  787. Xwhich contain the caller as a member.
  788. XThe
  789. X.LW verifier
  790. Xaccompanying the credentials should be of
  791. X.LW AUTH_NULL
  792. X(defined above).
  793. X.LP
  794. XThe value of the discriminate of the
  795. X.LW "response verifier"
  796. Xreceived in the reply message from the server may be
  797. X.LW AUTH_NULL
  798. Xor
  799. X.LW AUTH_SHORT .
  800. XIn the case of
  801. X.LW AUTH_SHORT ,
  802. Xthe bytes of the
  803. X.LW "response verifier" 's
  804. Xstring encode an
  805. X.LW auth_opaque
  806. Xstructure.
  807. XThis new
  808. X.LW auth_opaque
  809. Xstructure may now be passed to the server
  810. Xinstead of the original
  811. X.LW AUTH_UNIX
  812. Xflavor credentials.
  813. XThe server keeps a cache which maps short hand
  814. X.LW auth_opaque
  815. Xstructures (passed back by way of a
  816. X.LW AUTH_SHORT
  817. Xstyle
  818. X.LW "response verifier" )
  819. Xto the original credentials of the caller.
  820. XThe caller can save network bandwidth and server cpu cycles
  821. Xby using the new credentials.
  822. X.LP
  823. XThe server may flush the short hand
  824. X.LW auth_opaque
  825. Xstructure at any time.
  826. XIf this happens, the remote procedure call message
  827. Xwill be rejected due to an authentication error.
  828. XThe reason for the failure will be
  829. X.LW AUTH_REJECTEDCRED .
  830. XAt this point, the caller may wish to try the original
  831. X.LW AUTH_UNIX
  832. Xstyle of credentials.
  833. X.NH 2
  834. XRecord Marking Standard
  835. X.LP
  836. XWhen RPC messages are passed on top of a byte stream protocol
  837. X(like TCP/IP), it is necessary, or at least desirable,
  838. Xto delimit one message from another in order to detect
  839. Xand possibly recover from user protocol errors.
  840. XThis is called record marking (RM).
  841. XSun uses this RM/TCP/IP transport for passing
  842. XRPC messages on TCP streams.
  843. XOne RPC message fits into one RM record.
  844. X.LP
  845. XA record is composed of one or more record fragments.
  846. XA record fragment is a four-byte header followed by
  847. X.I 0
  848. Xto
  849. X.I "2\s-2\u31\d\s+2\-1"
  850. Xbytes of fragment data.
  851. XThe bytes encode an unsigned binary number;
  852. Xas with XDR integers, the byte order is from highest to lowest.
  853. XThe number encodes two values \(em
  854. Xa boolean which indicates whether the fragment is the last fragment
  855. Xof the record (bit value 1 implies the fragment is the last fragment)
  856. Xand a 31-bit unsigned binary value which is the length in bytes of the
  857. Xfragment's data.
  858. XThe boolean value is the highest-order bit of the header;
  859. Xthe length is the 31 low-order bits.
  860. X(Note that this record specification is
  861. X.I not
  862. Xin XDR standard form!)
  863. X.bp
  864. X.SH
  865. X.NH 0
  866. XAppendix A: Port Mapper Program Protocol
  867. X.LP
  868. XThe port mapper program maps RPC program and version numbers
  869. Xto UDP/IP or TCP/IP port numbers.
  870. XThis program makes dynamic binding of remote programs possible.
  871. X.LP
  872. XThis is desirable because the range of reserved port numbers is very small
  873. Xand the number of potential remote programs is very large.  By running only
  874. Xthe port mapper on a reserved port, the port numbers of other remote programs
  875. Xcan be ascertained by querying the port mapper.
  876. X.NH 2
  877. XThe RPC Protocol
  878. X.LP
  879. XThe protocol is specified by the XDR description language.
  880. X.LP
  881. X.BS
  882. X.LS
  883. XPort Mapper RPC Program Number: 100000
  884. X    Version Number: 1
  885. X    Supported Transports:
  886. X        UDP/IP on port 111
  887. X        RM/TCP/IP on port 111
  888. X.Lf
  889. X.BE
  890. X.NH 3
  891. XTransport Protocol Numbers
  892. X.BS
  893. X.LS
  894. X#define IPPROTO_TCP    6    /* protocol number for TCP/IP */
  895. X#define IPPROTO_UDP    17    /* protocol number for UDP/IP */
  896. X.Lf
  897. X.BE
  898. X.NH 3
  899. XRPC Procedures
  900. X.LP
  901. XHere is a list of RPC procedures:
  902. X.NE
  903. X.NH 4
  904. XDo Nothing
  905. X.LP
  906. XProcedure 0, Version 2.
  907. X.BS
  908. X.LS
  909. X0. PMAPPROC_NULL () returns ()
  910. X.Lf
  911. X.BE
  912. XThis procedure does no work.
  913. XBy convention, procedure zero of any protocol
  914. Xtakes no parameters and returns no results.
  915. X.NE
  916. X.NH 4
  917. XSet a Mapping
  918. X.LP
  919. XProcedure 1, Version 2.
  920. X.BS
  921. X.LS
  922. X1. PMAPPROC_SET (prog,vers,prot,port) returns (resp)
  923. X    unsigned prog;
  924. X    unsigned vers;
  925. X    unsigned prot;
  926. X    unsigned port;
  927. X    boolean resp;
  928. X.Lf
  929. X.BE
  930. XWhen a program first becomes available on a machine,
  931. Xit registers itself with the port mapper program on the same machine.
  932. XThe program passes its program number
  933. X.LW prog ,
  934. Xversion number
  935. X.LW vers ,
  936. Xtransport protocol number
  937. X.LW prot ,
  938. Xand the port
  939. X.LW port
  940. Xon which it awaits service request.
  941. XThe procedure returns
  942. X.LW resp ,
  943. Xwhose value is
  944. X.LW TRUE
  945. Xif the procedure successfully established the mapping and
  946. X.LW FALSE
  947. Xotherwise.  The procedure refuses to establish a mapping
  948. Xif one already exists for the tuple
  949. X.LW [prog,vers,prot] .
  950. X.NE
  951. X.NH 4
  952. XUnset a Mapping
  953. X.LP
  954. XProcedure 2, Version 2.
  955. X.BS
  956. X.LS
  957. X2. PMAPPROC_UNSET (prog,vers,dummy1,dummy2) returns (resp)
  958. X    unsigned prog;
  959. X    unsigned vers;
  960. X    unsigned dummy1;  /* value always ignored */
  961. X    unsigned dummy2;  /* value always ignored */
  962. X    boolean resp;
  963. X.Lf
  964. X.BE
  965. XWhen a program becomes unavailable, it should
  966. Xunregister itself with the port mapper program on the same machine.
  967. XThe parameters and results have meanings identical to those of
  968. X.LW PMAPPROC_SET .
  969. X.NE
  970. X.NH 4
  971. XLook Up a Mapping
  972. X.LP
  973. XProcedure 3, Version 2.
  974. X.BS
  975. X.LS
  976. X3. PMAPPROC_GETPORT (prog,vers,prot,dummy) returns (port)
  977. X    unsigned prog;
  978. X    unsigned vers;
  979. X    unsigned prot;
  980. X    unsigned dummy;    /* this value always ignored */
  981. X    unsigned port;    /* zero means program not registered */
  982. X.Lf
  983. X.BE
  984. XGiven a program number
  985. X.LW prog ,
  986. Xversion number
  987. X.LW vers ,
  988. Xand transport protocol number
  989. X.LW prot ,
  990. Xthis procedure returns the port number on which
  991. Xthe program is awaiting call requests.
  992. XA port value of zeros means the program has not been registered.
  993. X.NE
  994. X.NH 4
  995. XDumping the Mappings
  996. X.LP
  997. XProcedure 4, Version 2.
  998. X.BS
  999. X.LS
  1000. X4. PMAPPROC_DUMP () returns (maplist)
  1001. X    struct maplist {
  1002. X        union switch (boolean) {
  1003. X            FALSE: struct { /* void, end of list */ };
  1004. X            TRUE: struct {
  1005. X                unsigned prog;
  1006. X                unsigned vers;
  1007. X                unsigned prot;
  1008. X                unsigned port;
  1009. X                struct maplist the_rest;
  1010. X            };
  1011. X        };
  1012. X    } maplist;
  1013. X.Lf
  1014. X.BE
  1015. XThis procedure enumerates all entries in the port mapper's database.
  1016. XThe procedure takes no parameters and returns a list of
  1017. Xprogram, version, protocol, and port values.
  1018. X.NE
  1019. X.NH 4
  1020. XIndirect Call Routine
  1021. X.LP
  1022. XProcedure 5, Version 2.
  1023. X.BS
  1024. X.LS
  1025. X5. PMAPPROC_CALLIT (prog,vers,proc,args) returns (port,res)
  1026. X    unsigned prog;
  1027. X    unsigned vers;
  1028. X    unsigned proc;
  1029. X    string args<>;
  1030. X    unsigned port;
  1031. X    string res<>;
  1032. X.Lf
  1033. X.BE
  1034. XThis procedure allows a caller to call another remote procedure
  1035. Xon the same machine without knowing the remote procedure's port number.
  1036. XIts intended use is for supporting broadcasts
  1037. Xto arbitrary remote programs via the well-known port mapper's port.
  1038. XThe parameters
  1039. X.LW prog ,
  1040. X.LW vers ,
  1041. X.LW proc ,
  1042. Xand the bytes of
  1043. X.LW args
  1044. Xare the program number, version number, procedure number,
  1045. Xand parameters of the remote procedure.
  1046. XNote:
  1047. X.IP 1.
  1048. XThis procedure only sends a response if the procedure was
  1049. Xsuccessfully executed and is silent (no response) otherwise.
  1050. X.IP 2.
  1051. XThe port mapper communicates with the remote program using UDP/IP only.
  1052. X.LP
  1053. XThe procedure returns the remote program's port number,
  1054. Xand the bytes of results are the results of the remote procedure.
  1055. SHAR_EOF
  1056. if test 23693 -ne "`wc -c < 'rpc/doc/rpc.spec'`"
  1057. then
  1058.     echo shar: "error transmitting 'rpc/doc/rpc.spec'" '(should have been 23693 characters)'
  1059. fi
  1060. chmod 444 'rpc/doc/rpc.spec'
  1061. fi
  1062. echo shar: "extracting 'rpc/doc/runoff'" '(353 characters)'
  1063. if test -f 'rpc/doc/runoff'
  1064. then
  1065.     echo shar: "will not over-write existing file 'rpc/doc/runoff'"
  1066. else
  1067. sed 's/^X//' << \SHAR_EOF > 'rpc/doc/runoff'
  1068. X#! /bin/sh 
  1069. X#
  1070. X# usage: runoff file
  1071. X# output goes to stdout
  1072. X#
  1073. X
  1074. XROFF=nroff
  1075. XTBL=tbl
  1076. XEQN=neqn
  1077. X
  1078. Xcase $1 in
  1079. X    rpc.prog)
  1080. X        $TBL sunhead.ms rpc.prog.p[12] | $ROFF -ms -rF1 
  1081. X        ;;
  1082. X    xdr.spec)
  1083. X        $TBL sunhead.ms xdr.spec.p[12] | $EQN $dev | $ROFF -ms -rF1 
  1084. X        ;;
  1085. X    rpc.spec)
  1086. X        $ROFF -ms -rF1 sunhead.ms rpc.spec 
  1087. X        ;;
  1088. X    *)
  1089. X        echo Don\'t know how to runoff $1.
  1090. X        ;;
  1091. Xesac
  1092. SHAR_EOF
  1093. if test 353 -ne "`wc -c < 'rpc/doc/runoff'`"
  1094. then
  1095.     echo shar: "error transmitting 'rpc/doc/runoff'" '(should have been 353 characters)'
  1096. fi
  1097. chmod 775 'rpc/doc/runoff'
  1098. fi
  1099. echo shar: "extracting 'rpc/doc/runoff.troff'" '(436 characters)'
  1100. if test -f 'rpc/doc/runoff.troff'
  1101. then
  1102.     echo shar: "will not over-write existing file 'rpc/doc/runoff.troff'"
  1103. else
  1104. sed 's/^X//' << \SHAR_EOF > 'rpc/doc/runoff.troff'
  1105. X#! /bin/sh 
  1106. X#
  1107. X# usage: runoff.troff file [-Tdevtype]
  1108. X#
  1109. X
  1110. XROFF=nice troff
  1111. XTBL=tbl
  1112. XEQN=eqn
  1113. XPIC=pic
  1114. X
  1115. Xcase $2 in
  1116. X    -Tlw)
  1117. X        dev=-Tlw
  1118. X        ;;
  1119. X    *)
  1120. X        ;;
  1121. Xesac
  1122. Xcase $1 in
  1123. X    rpc.prog)
  1124. X        $PIC -D $dev sunhead.ms rpc.prog.p[12] | $TBL | \
  1125. X            $ROFF $2 -ms -rF1 
  1126. X        ;;
  1127. X    xdr.spec)
  1128. X        $TBL sunhead.ms xdr.spec.p[12] | $EQN $dev | $ROFF $2 -ms -rF1 
  1129. X        ;;
  1130. X    rpc.spec)
  1131. X        $ROFF $2 -ms -rF1 sunhead.ms rpc.spec 
  1132. X        ;;
  1133. X    *)
  1134. X        echo Don\'t know how to runoff $1.
  1135. X        ;;
  1136. Xesac
  1137. SHAR_EOF
  1138. if test 436 -ne "`wc -c < 'rpc/doc/runoff.troff'`"
  1139. then
  1140.     echo shar: "error transmitting 'rpc/doc/runoff.troff'" '(should have been 436 characters)'
  1141. fi
  1142. chmod 775 'rpc/doc/runoff.troff'
  1143. fi
  1144. echo shar: "extracting 'rpc/doc/sunhead.ms'" '(1316 characters)'
  1145. if test -f 'rpc/doc/sunhead.ms'
  1146. then
  1147.     echo shar: "will not over-write existing file 'rpc/doc/sunhead.ms'"
  1148. else
  1149. sed 's/^X//' << \SHAR_EOF > 'rpc/doc/sunhead.ms'
  1150. X.\"
  1151. X.\" Header File for Sun Manuals
  1152. X.\" Use with -ms macros
  1153. X.\" Adapted from TIS course header
  1154. X.\" Sally Rutter, The Instruction Set
  1155. X.\" 19th November 1985
  1156. X.\"
  1157. X.nr PS 11
  1158. X.nr VS 14
  1159. X.ds Un \s-1UNIX\s0
  1160. X.\" define string Un = UNIX in smaller point size
  1161. X.fp 7 L
  1162. X.\" Put constant width font in position 7
  1163. X.fp 6 LB
  1164. X.\" Put bold constant width font in position 6
  1165. X.\" The next 2 definitions are for constant width displays
  1166. X.\" LS for display start and Lf for display finish
  1167. X.de LS
  1168. X.DS \\$1 \\$2 \\$3
  1169. X.nf
  1170. X.ft 7
  1171. X.ps 10
  1172. X.vs 12
  1173. X.nr Tw \w'a'*8
  1174. X.ta \\n(Twu,+\\n(Twu,+\\n(Twu,+\\n(Twu,+\\n(Twu,+\\n(Twu,+\\n(Twu
  1175. X..
  1176. X.de Lf
  1177. X.ft
  1178. X.fi
  1179. X.ps 11
  1180. X.vs 14
  1181. X.DE
  1182. X..
  1183. X.\" The next definition is for text in constant width font.
  1184. X.de LW
  1185. X.ie\\n(.$ .nr ;G \\n(.f
  1186. X.el.ft 7
  1187. X.if\\n(.$ .if !\\n(.$-2 \&\f7\\$1\fP\\$2
  1188. X.if\\n(.$-2 \{.ds }i
  1189. X.if\\n(.f2 .ds }i \^
  1190. X.ds}I \&\f7\\$1\fP\\$2\\*(}i
  1191. X'br\}
  1192. X.if\\n(.$-2 .if !\\n(.$-4 \\*(}I\f7\\$3\fP\\$4
  1193. X.if\\n(.$-4 .if !\\n(.$-6 \\*(}I\f7\\$3\fP\\$4\\*(}i\f7\\$5\fP\\$6
  1194. X.if\\n(.$ .ft \\n(;G
  1195. X..
  1196. X.\" The next definition ensures that there is at least
  1197. X.\" 0.5i left on the page when a sub-heading is called
  1198. X.rn SH Sh
  1199. X.de SH
  1200. X.br
  1201. X.ne 1.5i
  1202. X.Sh
  1203. X..
  1204. X.\" The next definition is simply a need macro
  1205. X.       \" NE - need space
  1206. X.de NE
  1207. X.br
  1208. X.ne 2i
  1209. X..
  1210. X.de Pb
  1211. X'bp
  1212. X..
  1213. X.wh -1i Pb
  1214. X.\" Need the definition of index (IX) from somewhere ...
  1215. X
  1216. SHAR_EOF
  1217. if test 1316 -ne "`wc -c < 'rpc/doc/sunhead.ms'`"
  1218. then
  1219.     echo shar: "error transmitting 'rpc/doc/sunhead.ms'" '(should have been 1316 characters)'
  1220. fi
  1221. chmod 444 'rpc/doc/sunhead.ms'
  1222. fi
  1223. echo shar: "extracting 'rpc/tools/rpcinfo.8'" '(1084 characters)'
  1224. if test -f 'rpc/tools/rpcinfo.8'
  1225. then
  1226.     echo shar: "will not over-write existing file 'rpc/tools/rpcinfo.8'"
  1227. else
  1228. sed 's/^X//' << \SHAR_EOF > 'rpc/tools/rpcinfo.8'
  1229. X.\" @(#)rpcinfo.8 1.1 85/12/28 SMI;
  1230. X.TH RPCINFO 8 "1 February 1985"
  1231. X.SH NAME
  1232. Xrpcinfo \- report RPC information
  1233. X.SH SYNOPSIS
  1234. X.B "rpcinfo \-p"
  1235. X[ host ]
  1236. X.br
  1237. X.B "rpcinfo \-u"
  1238. Xhost program-number
  1239. X[ version-number ]
  1240. X.br
  1241. X.B "rpcinfo \-t"
  1242. Xhost program-number
  1243. X[ version-number ]
  1244. X.SH DESCRIPTION
  1245. X.IX  "rpcinfo command"  ""  "\fLrpcinfo\fP \(em report RPC information"
  1246. X.I Rpcinfo
  1247. Xmakes an RPC call to an RPC server and reports what it finds.
  1248. X.SH OPTIONS
  1249. X.TP
  1250. X.B \-p
  1251. XProbe the portmapper on
  1252. X.IR host ,
  1253. Xand print a list of all registered RPC programs.
  1254. XIf 
  1255. X.I host
  1256. Xis not specified, it defaults to the value returned by
  1257. X.IR hostname (1).
  1258. X.TP
  1259. X.B \-u
  1260. XMake an RPC call to procedure 0 of
  1261. X.I program-number
  1262. Xusing UDP, and report whether a response was received.
  1263. X.TP
  1264. X.B \-t
  1265. XMake an RPC call to procedure 0 of
  1266. X.I program-number
  1267. Xusing TCP, and report whether a response was received.
  1268. X.LP
  1269. XThe
  1270. X.I program-number
  1271. Xargument can be either a name or a number.  If no version is given,
  1272. Xit defaults to 1.
  1273. X.SH FILES
  1274. X/etc/rpc    names for rpc program numbers
  1275. X.SH "SEE ALSO"
  1276. X.I "RPC Programming Guide,"
  1277. Xrpc(5), portmap(8)
  1278. SHAR_EOF
  1279. if test 1084 -ne "`wc -c < 'rpc/tools/rpcinfo.8'`"
  1280. then
  1281.     echo shar: "error transmitting 'rpc/tools/rpcinfo.8'" '(should have been 1084 characters)'
  1282. fi
  1283. chmod 444 'rpc/tools/rpcinfo.8'
  1284. fi
  1285. echo shar: "extracting 'rpc/tools/rpcinfo.c'" '(6047 characters)'
  1286. if test -f 'rpc/tools/rpcinfo.c'
  1287. then
  1288.     echo shar: "will not over-write existing file 'rpc/tools/rpcinfo.c'"
  1289. else
  1290. sed 's/^X//' << \SHAR_EOF > 'rpc/tools/rpcinfo.c'
  1291. X/*      rpcinfo.c     1.1     86/02/05     */
  1292. X
  1293. X/*
  1294. X * Copyright (C) 1984, Sun Microsystems, Inc.
  1295. X */
  1296. X
  1297. X/*
  1298. X * rpcinfo: ping a particular rpc program
  1299. X *     or dump the portmapper
  1300. X */
  1301. X
  1302. X/*
  1303. X * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  1304. X * unrestricted use provided that this legend is included on all tape
  1305. X * media and as a part of the software program in whole or part.  Users
  1306. X * may copy or modify Sun RPC without charge, but are not authorized
  1307. X * to license or distribute it to anyone else except as part of a product or
  1308. X * program developed by the user.
  1309. X * 
  1310. X * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  1311. X * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  1312. X * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  1313. X * 
  1314. X * Sun RPC is provided with no support and without any obligation on the
  1315. X * part of Sun Microsystems, Inc. to assist in its use, correction,
  1316. X * modification or enhancement.
  1317. X * 
  1318. X * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  1319. X * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  1320. X * OR ANY PART THEREOF.
  1321. X * 
  1322. X * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  1323. X * or profits or other special, indirect and consequential damages, even if
  1324. X * Sun has been advised of the possibility of such damages.
  1325. X * 
  1326. X * Sun Microsystems, Inc.
  1327. X * 2550 Garcia Avenue
  1328. X * Mountain View, California  94043
  1329. X */
  1330. X
  1331. X#include <rpc/rpc.h>
  1332. X#include <stdio.h>
  1333. X#include <sys/socket.h>
  1334. X#include <sys/time.h>
  1335. X#include <netdb.h>
  1336. X#include <rpc/pmap_prot.h>
  1337. X#include <rpc/pmap_clnt.h>
  1338. X#include <ctype.h>
  1339. X
  1340. X#define MAXHOSTLEN 256
  1341. X
  1342. Xmain(argc, argv)
  1343. X    char **argv;
  1344. X{
  1345. X    if (argc < 2) {
  1346. X        usage();
  1347. X        exit(1);
  1348. X    }
  1349. X    if (argv[1][0] == '-') {
  1350. X        switch(argv[1][1]) {
  1351. X            case 't':
  1352. X                tcpping(argc-1, argv+1);
  1353. X                break;
  1354. X            case 'p':
  1355. X                pmapdump(argc-1, argv+1);
  1356. X                break;
  1357. X            case 'u':
  1358. X                udpping(argc-1, argv+1);
  1359. X                break;
  1360. X            default:
  1361. X                usage();
  1362. X                exit(1);
  1363. X                break;
  1364. X        }
  1365. X    }
  1366. X    else
  1367. X        usage();
  1368. X}
  1369. X        
  1370. Xudpping(argc, argv)
  1371. X    char **argv;
  1372. X{
  1373. X    int ans, prognum, vers;
  1374. X    struct rpcent *rpc;
  1375. X    
  1376. X    if (argc < 3 || argc > 4) {
  1377. X        usage();
  1378. X        exit(1);
  1379. X    }
  1380. X    if (isalpha(argv[2][0])) {
  1381. X        rpc = getrpcbyname(argv[2]);
  1382. X        if (rpc == NULL) {
  1383. X            fprintf(stderr, "%s is unknown name\n", argv[2]);
  1384. X            exit(1);
  1385. X        }
  1386. X        prognum = rpc->r_number;
  1387. X    }
  1388. X    else
  1389. X        prognum = atoi(argv[2]);
  1390. X    if (argc == 3)
  1391. X        vers = 1;
  1392. X    else
  1393. X        vers = atoi(argv[3]);
  1394. X    ans = callrpc(argv[1], prognum, vers, NULLPROC,
  1395. X        xdr_void, 0, xdr_void, 0);
  1396. X    if (ans != 0) {
  1397. X        clnt_perrno(ans);
  1398. X        fprintf(stderr, "\n");
  1399. X        printf("program %d version %d is not available\n",
  1400. X            prognum, vers);
  1401. X        exit(1);
  1402. X    }
  1403. X    else
  1404. X        printf("program %d version %d ready and waiting\n",
  1405. X            prognum, vers);
  1406. X}
  1407. X
  1408. Xtcpping(argc, argv)
  1409. X    int argc;
  1410. X    char **argv;
  1411. X{
  1412. X    struct timeval to;
  1413. X    struct sockaddr_in addr;
  1414. X    enum clnt_stat rpc_stat;
  1415. X    CLIENT *client;
  1416. X    int prognum, vers;
  1417. X    int sock = -1;
  1418. X    struct hostent *hp;
  1419. X    struct rpcent *rpc;
  1420. X
  1421. X    if (argc < 3 || argc > 4) {
  1422. X        usage();
  1423. X        exit(1);
  1424. X    }
  1425. X    if (isalpha(argv[2][0])) {
  1426. X        rpc = getrpcbyname(argv[2]);
  1427. X        if (rpc == NULL) {
  1428. X            fprintf(stderr, "%s is unknown name\n", argv[2]);
  1429. X            exit(1);
  1430. X        }
  1431. X        prognum = rpc->r_number;
  1432. X    }
  1433. X    else
  1434. X        prognum = atoi(argv[2]);
  1435. X    if ((hp = gethostbyname(argv[1])) == NULL) {
  1436. X        fprintf(stderr, "can't find %s\n", argv[1]);
  1437. X        exit(1);
  1438. X    }
  1439. X    addr.sin_family = AF_INET;
  1440. X    addr.sin_port = 0;
  1441. X    addr.sin_addr.s_addr = *(int *)hp->h_addr;
  1442. X    if (argc == 3)
  1443. X        vers = 1;
  1444. X    else
  1445. X        vers = atoi(argv[3]);
  1446. X    if ((client = clnttcp_create(&addr, prognum,
  1447. X        vers, &sock, 0, 0)) == NULL) {
  1448. X            clnt_pcreateerror("");
  1449. X            printf("program %d version %d is not available\n",
  1450. X                prognum, vers);
  1451. X            exit(1);
  1452. X        }
  1453. X    to.tv_usec = 0;
  1454. X    to.tv_sec = 10;
  1455. X    rpc_stat = clnt_call(client, 0, xdr_void, NULL, xdr_void, NULL, to);
  1456. X    if (rpc_stat != RPC_SUCCESS) {
  1457. X        clnt_perrno(rpc_stat);
  1458. X        fprintf(stderr, "\n");
  1459. X        printf("program %d version %d is not available\n",
  1460. X            prognum, vers);
  1461. X        exit(1);
  1462. X    }
  1463. X    else
  1464. X        printf("program %d version %d ready and waiting\n",
  1465. X            prognum, vers);
  1466. X}
  1467. X
  1468. Xpmapdump(argc, argv)
  1469. X    int argc;
  1470. X    char **argv;
  1471. X{
  1472. X    struct sockaddr_in server_addr;
  1473. X    struct hostent *hp;
  1474. X    struct pmaplist *head = NULL;
  1475. X    char hoststr[MAXHOSTLEN];
  1476. X    int socket = -1;
  1477. X    struct timeval minutetimeout;
  1478. X    char *hostnm;
  1479. X    register CLIENT *client;
  1480. X    enum clnt_stat rpc_stat;
  1481. X    struct rpcent *rpc;
  1482. X    
  1483. X    if (argc > 2) {
  1484. X        usage();
  1485. X        exit(1);
  1486. X    }
  1487. X    if (argc == 2) {
  1488. X        hostnm = argv[1];
  1489. X    } else {
  1490. X        gethostname(hoststr, sizeof(hoststr));
  1491. X        hostnm = hoststr;
  1492. X    }
  1493. X    if ((hp = gethostbyname(hostnm)) == NULL) {
  1494. X        fprintf(stderr, "cannot get addr for '%s'\n", hostnm);
  1495. X        exit(0);
  1496. X    }
  1497. X    bcopy(hp->h_addr, (caddr_t)&server_addr.sin_addr, hp->h_length);
  1498. X    server_addr.sin_family = AF_INET;
  1499. X    minutetimeout.tv_sec = 60;
  1500. X    minutetimeout.tv_usec = 0;
  1501. X    server_addr.sin_port = htons(PMAPPORT);
  1502. X    if ((client = clnttcp_create(&server_addr, PMAPPROG,
  1503. X        PMAPVERS, &socket, 50, 500)) == NULL) {
  1504. X        clnt_pcreateerror("rpcinfo: can't contact portmapper");
  1505. X        exit(1);
  1506. X    }
  1507. X    if ((rpc_stat = clnt_call(client, PMAPPROC_DUMP, xdr_void, NULL,
  1508. X        xdr_pmaplist, &head, minutetimeout)) != RPC_SUCCESS) {
  1509. X        fprintf(stderr, "rpcinfo: can't contact portmapper: ");
  1510. X        clnt_perrno(rpc_stat);
  1511. X        fprintf(stderr, "\n");
  1512. X        exit(1);
  1513. X    }
  1514. X    if (head == NULL) {
  1515. X        printf("No remote programs registered.\n");
  1516. X    } else {
  1517. X        printf("   program vers proto   port\n");
  1518. X        for (; head != NULL; head = head->pml_next) {
  1519. X            printf("%10ld%5ld",
  1520. X                head->pml_map.pm_prog,
  1521. X                head->pml_map.pm_vers);
  1522. X            if (head->pml_map.pm_prot == IPPROTO_UDP)
  1523. X                printf("%6s",  "udp");
  1524. X            else if (head->pml_map.pm_prot == IPPROTO_TCP)
  1525. X                printf("%6s", "tcp");
  1526. X            else
  1527. X                printf("%6ld",  head->pml_map.pm_prot);
  1528. X            printf("%7ld",  head->pml_map.pm_port);
  1529. X            rpc = getrpcbynumber(head->pml_map.pm_prog);
  1530. X            if (rpc)
  1531. X                printf("  %s\n", rpc->r_name);
  1532. X            else
  1533. X                printf("\n");
  1534. X        }
  1535. X    }
  1536. X}
  1537. X
  1538. Xusage()
  1539. X{
  1540. X    fprintf(stderr, "Usage: rpcinfo -u host prognum [versnum]\n");
  1541. X    fprintf(stderr, "       rpcinfo -t host prognum [versnum]\n");
  1542. X    fprintf(stderr, "       rpcinfo -p [host]\n");
  1543. X}
  1544. SHAR_EOF
  1545. if test 6047 -ne "`wc -c < 'rpc/tools/rpcinfo.c'`"
  1546. then
  1547.     echo shar: "error transmitting 'rpc/tools/rpcinfo.c'" '(should have been 6047 characters)'
  1548. fi
  1549. chmod 444 'rpc/tools/rpcinfo.c'
  1550. fi
  1551. echo shar: "extracting 'rpc/toys/Makefile'" '(250 characters)'
  1552. if test -f 'rpc/toys/Makefile'
  1553. then
  1554.     echo shar: "will not over-write existing file 'rpc/toys/Makefile'"
  1555. else
  1556. sed 's/^X//' << \SHAR_EOF > 'rpc/toys/Makefile'
  1557. XCFLAGS= -O
  1558. X
  1559. Xall: sortit sort_service
  1560. X
  1561. Xsortit: sortit.o sort_prot.o
  1562. X    ${CC} ${CFLAGS} sortit.o sort_prot.o -o sortit
  1563. X
  1564. Xsort_service: sort_service.o sort_prot.o
  1565. X    ${CC} ${CFLAGS} sort_service.o sort_prot.o -o sort_service
  1566. X
  1567. X.c.o:
  1568. X    ${CC} ${CFLAGS} -c $*.c
  1569. X
  1570. SHAR_EOF
  1571. if test 250 -ne "`wc -c < 'rpc/toys/Makefile'`"
  1572. then
  1573.     echo shar: "error transmitting 'rpc/toys/Makefile'" '(should have been 250 characters)'
  1574. fi
  1575. chmod 444 'rpc/toys/Makefile'
  1576. fi
  1577. echo shar: "extracting 'rpc/toys/sort_prot.c'" '(298 characters)'
  1578. if test -f 'rpc/toys/sort_prot.c'
  1579. then
  1580.     echo shar: "will not over-write existing file 'rpc/toys/sort_prot.c'"
  1581. else
  1582. sed 's/^X//' << \SHAR_EOF > 'rpc/toys/sort_prot.c'
  1583. X/*
  1584. X * sort_prot.c
  1585. X * Implements the protcol filter for the toy sort service.
  1586. X */
  1587. X
  1588. X#include <rpc/rpc.h>
  1589. X#include "sort_prot.h"
  1590. X
  1591. Xint
  1592. Xxdr_sortstrings(xdrs, ssp)
  1593. X    XDR *xdrs;
  1594. X    struct sortstrings *ssp;
  1595. X{
  1596. X
  1597. X    return (xdr_array(xdrs, &ssp->s, &ssp->ns, MAXSORTSIZE,
  1598. X        sizeof (char *), xdr_wrapstring));
  1599. X}
  1600. SHAR_EOF
  1601. if test 298 -ne "`wc -c < 'rpc/toys/sort_prot.c'`"
  1602. then
  1603.     echo shar: "error transmitting 'rpc/toys/sort_prot.c'" '(should have been 298 characters)'
  1604. fi
  1605. chmod 444 'rpc/toys/sort_prot.c'
  1606. fi
  1607. echo shar: "extracting 'rpc/toys/sort_prot.h'" '(453 characters)'
  1608. if test -f 'rpc/toys/sort_prot.h'
  1609. then
  1610.     echo shar: "will not over-write existing file 'rpc/toys/sort_prot.h'"
  1611. else
  1612. sed 's/^X//' << \SHAR_EOF > 'rpc/toys/sort_prot.h'
  1613. X/*
  1614. X * Protocol for a sorting service.
  1615. X */
  1616. X
  1617. X#define SORTPROG    ((long) 22855)
  1618. X#define SORTVERS    ((long) 1)
  1619. X#define SORT        ((long) 1)
  1620. X
  1621. X/*
  1622. X * The sort procedure receives an array of strings and returns an array
  1623. X * of strings.  This toy service handles a maximum of 64 strings.
  1624. X */
  1625. X#define MAXSORTSIZE    ((long) 64)
  1626. X
  1627. Xstruct sortstrings {
  1628. X    long    ns;  /* number of strings in the array */
  1629. X    char    **s; /* pointer to the array of strings */
  1630. X};
  1631. X
  1632. Xint xdr_sortstrings();
  1633. X
  1634. SHAR_EOF
  1635. if test 453 -ne "`wc -c < 'rpc/toys/sort_prot.h'`"
  1636. then
  1637.     echo shar: "error transmitting 'rpc/toys/sort_prot.h'" '(should have been 453 characters)'
  1638. fi
  1639. chmod 444 'rpc/toys/sort_prot.h'
  1640. fi
  1641. echo shar: "extracting 'rpc/toys/sort_service.c'" '(557 characters)'
  1642. if test -f 'rpc/toys/sort_service.c'
  1643. then
  1644.     echo shar: "will not over-write existing file 'rpc/toys/sort_service.c'"
  1645. else
  1646. sed 's/^X//' << \SHAR_EOF > 'rpc/toys/sort_service.c'
  1647. X/*
  1648. X * sort_service.c
  1649. X * Implements the server side of the sort_service.
  1650. X */
  1651. X
  1652. X#include <rpc/rpc.h>
  1653. X#include "sort_prot.h"
  1654. X
  1655. Xstatic int
  1656. Xcomparestrings(sp1, sp2) 
  1657. X    char **sp1, **sp2;
  1658. X{
  1659. X
  1660. X    return (strcmp(*sp1, *sp2));
  1661. X}
  1662. X
  1663. Xstatic struct sortstrings *
  1664. Xsort(ssp)
  1665. X    struct sortstrings *ssp;
  1666. X{
  1667. X
  1668. X    qsort(ssp->s, ssp->ns, sizeof (char *), comparestrings);
  1669. X    return(ssp);
  1670. X}
  1671. X
  1672. Xmain()
  1673. X{
  1674. X
  1675. X    /* register the serive */
  1676. X    registerrpc(SORTPROG, SORTVERS, SORT,
  1677. X        sort, xdr_sortstrings, xdr_sortstrings);
  1678. X
  1679. X    /* run the service forever */
  1680. X    svc_run();  /* never returns */
  1681. X    exit(1);
  1682. X}
  1683. X
  1684. SHAR_EOF
  1685. if test 557 -ne "`wc -c < 'rpc/toys/sort_service.c'`"
  1686. then
  1687.     echo shar: "error transmitting 'rpc/toys/sort_service.c'" '(should have been 557 characters)'
  1688. fi
  1689. chmod 444 'rpc/toys/sort_service.c'
  1690. fi
  1691. echo shar: "extracting 'rpc/toys/sortit.c'" '(622 characters)'
  1692. if test -f 'rpc/toys/sortit.c'
  1693. then
  1694.     echo shar: "will not over-write existing file 'rpc/toys/sortit.c'"
  1695. else
  1696. sed 's/^X//' << \SHAR_EOF > 'rpc/toys/sortit.c'
  1697. X/*
  1698. X * sortit.c
  1699. X * Client side application which sorts argc, argv.
  1700. X */
  1701. X#include <stdio.h>
  1702. X#include <rpc/rpc.h>
  1703. X#include "sort_prot.h"
  1704. X
  1705. Xmain(argc, argv)
  1706. X    int argc;
  1707. X    char **argv;
  1708. X{
  1709. X    char *machinename;
  1710. X    struct sortstrings args, res;
  1711. X    int i;
  1712. X
  1713. X    if (argc < 2) {
  1714. X        fprintf(stderr, "usage: %s machinename [s1 ...]\n", argv[0]);
  1715. X        exit(1);
  1716. X    }
  1717. X    machinename = argv[1];
  1718. X    args.ns = argc;
  1719. X    args.s = argv;
  1720. X    res.s = (char **)NULL;
  1721. X
  1722. X    callrpc(machinename, SORTPROG, SORTVERS, SORT,
  1723. X        xdr_sortstrings, &args, xdr_sortstrings, &res);
  1724. X
  1725. X    for (i = 0; i < res.ns; i++) {
  1726. X        printf("%s\n", res.s[i]);
  1727. X    }
  1728. X
  1729. X    /* should free res here */
  1730. X    exit(0);
  1731. X}
  1732. X
  1733. SHAR_EOF
  1734. if test 622 -ne "`wc -c < 'rpc/toys/sortit.c'`"
  1735. then
  1736.     echo shar: "error transmitting 'rpc/toys/sortit.c'" '(should have been 622 characters)'
  1737. fi
  1738. chmod 444 'rpc/toys/sortit.c'
  1739. fi
  1740. echo shar: "extracting 'rpc/rpclib/Makefile'" '(3535 characters)'
  1741. if test -f 'rpc/rpclib/Makefile'
  1742. then
  1743.     echo shar: "will not over-write existing file 'rpc/rpclib/Makefile'"
  1744. else
  1745. sed 's/^X//' << \SHAR_EOF > 'rpc/rpclib/Makefile'
  1746. X#
  1747. X#     Makefile    1.1    86/02/03
  1748. X#
  1749. XDESTDIR=
  1750. X
  1751. XSRC=    auth_none.c auth_unix.c authunix_prot.c \
  1752. X    clnt_perror.c clnt_raw.c clnt_simple.c clnt_tcp.c clnt_udp.c \
  1753. X    pmap_clnt.c pmap_getmaps.c pmap_getport.c pmap_prot.c pmap_rmt.c rpc_prot.c \
  1754. X    svc.c svc_auth.c svc_auth_unix.c svc_raw.c svc_simple.c \
  1755. X    svc_tcp.c svc_udp.c xdr.c xdr_array.c xdr_float.c xdr_mem.c xdr_rec.c xdr_reference.c xdr_stdio.c
  1756. X
  1757. XOBJ=    auth_none.o auth_unix.o authunix_prot.o clnt_perror.o clnt_raw.o\
  1758. X    clnt_simple.o clnt_tcp.o clnt_udp.o \
  1759. X    pmap_clnt.o pmap_getmaps.o pmap_getport.o pmap_prot.o pmap_rmt.o rpc_prot.o \
  1760. X    svc.o svc_auth.o svc_auth_unix.o svc_raw.o svc_simple.o \
  1761. X    svc_tcp.o svc_udp.o xdr.o xdr_array.o xdr_float.o xdr_mem.o xdr_rec.o xdr_reference.o xdr_stdio.o
  1762. XINC=    auth.h auth_unix.h clnt.h pmap_clnt.h\
  1763. X    pmap_prot.h rpc.h rpc_msg.h svc.h svc_auth.h types.h xdr.h
  1764. X
  1765. XCFLAGS= -O -A-R
  1766. X
  1767. X.c.o:
  1768. X    ${CC} -p -c ${CFLAGS} $*.c
  1769. X    -ld -X -r $*.o
  1770. X    mv a.out profiled/$*.o
  1771. X    ${CC} ${CFLAGS} -c $*.c
  1772. X    -ld -x -r $*.o
  1773. X    mv a.out $*.o
  1774. X
  1775. Xrpclib rpclib_p: ${OBJ}
  1776. X    @echo "building profiled rpclib"
  1777. X    @cd profiled; ar cru ../rpclib_p ${OBJ}
  1778. X    @echo "building normal rpclib"
  1779. X    @ar cru rpclib ${OBJ}
  1780. X
  1781. Xinstall:
  1782. X    -mkdir ${DESTDIR}/usr/include/rpc && \
  1783. X        chown bin ${DESTDIR}/usr/include/rpc && \
  1784. X        chmod 755 ${DESTDIR}/usr/include/rpc
  1785. X    -for i in *.h; do \
  1786. X        (install -c -m 644 $$i ${DESTDIR}/usr/include/rpc) done
  1787. X
  1788. Xtags: $(SRC) $(KSRC) $(INC)
  1789. X    ctags -tw $(SRC) $(KSRC) $(INC)
  1790. X
  1791. Xref: tags
  1792. X    sed 's,    /.*,,' tags | \
  1793. X    awk ' { printf("%-26s%-16s%s\n", $$1, $$2, $$3) }' > ref
  1794. X
  1795. Xlint:
  1796. X    lint -bnuvx $(SRC)
  1797. X
  1798. Xprint:
  1799. X    pr $(INC) $(SRC) $(KSRC) | lpr -Pvp
  1800. X
  1801. Xclean:
  1802. X    rm -f $(OBJ) rpclib rpclib_p linted made profiled/*.o
  1803. X
  1804. Xdepend:
  1805. X    @-grep '^#include' $(SRC) | grep -v '<' | grep -v '../' | \
  1806. X    sed 's/:[^"]*"\([^"]*\)".*/: \1/' | sed 's/\.[cs]:/.o:/' | \
  1807. X    awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
  1808. X        else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
  1809. X               else rec = rec " " $$2 } } \
  1810. X          END { print rec } ' >> makedep
  1811. X    @echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
  1812. X    @echo '$$r makedep' >>eddep
  1813. X    @echo 'w' >>eddep
  1814. X    @cp Makefile makefile.bak
  1815. X    @ed - Makefile < eddep
  1816. X    @rm eddep makedep makefile.bak
  1817. X
  1818. X
  1819. X
  1820. X# DO NOT DELETE THIS LINE
  1821. X
  1822. Xauth_none.o: types.h xdr.h auth.h
  1823. Xauth_unix.o: types.h xdr.h auth.h auth_unix.h
  1824. Xauthunix_prot.o: types.h xdr.h auth.h auth_unix.h
  1825. Xclnt_perror.o: types.h xdr.h auth.h clnt.h rpc_msg.h
  1826. Xclnt_raw.o: types.h xdr.h auth.h clnt.h rpc_msg.h
  1827. Xclnt_tcp.o: types.h xdr.h auth.h clnt.h rpc_msg.h pmap_clnt.h
  1828. Xclnt_udp.o: types.h xdr.h auth.h clnt.h rpc_msg.h pmap_clnt.h
  1829. Xpmap_clnt.o: types.h xdr.h auth.h clnt.h rpc_msg.h pmap_prot.h pmap_clnt.h
  1830. Xpmap_getmaps.o: types.h xdr.h auth.h clnt.h rpc_msg.h pmap_prot.h pmap_clnt.h
  1831. Xpmap_getport.o: types.h xdr.h auth.h clnt.h rpc_msg.h pmap_prot.h pmap_clnt.h
  1832. Xpmap_prot.o: types.h xdr.h pmap_prot.h
  1833. Xpmap_rmt.o: types.h xdr.h auth.h clnt.h rpc_msg.h pmap_prot.h pmap_clnt.h
  1834. Xrpc_prot.o: types.h xdr.h auth.h clnt.h rpc_msg.h
  1835. Xsvc.o: types.h xdr.h auth.h clnt.h rpc_msg.h svc.h svc_auth.h pmap_clnt.h
  1836. Xsvc_auth.o: types.h xdr.h auth.h clnt.h rpc_msg.h svc.h svc_auth.h
  1837. Xsvc_auth_unix.o: types.h xdr.h auth.h clnt.h rpc_msg.h svc.h auth_unix.h
  1838. Xsvc_auth_unix.o: svc_auth.h
  1839. Xsvc_raw.o: types.h xdr.h auth.h clnt.h rpc_msg.h svc.h
  1840. Xsvc_tcp.o: types.h xdr.h auth.h clnt.h rpc_msg.h svc.h
  1841. Xsvc_udp.o: types.h xdr.h auth.h clnt.h rpc_msg.h svc.h
  1842. Xxdr.o: types.h xdr.h
  1843. Xxdr_array.o: types.h xdr.h
  1844. Xxdr_float.o: types.h xdr.h
  1845. Xxdr_mem.o: types.h xdr.h
  1846. Xxdr_rec.o: types.h xdr.h
  1847. Xxdr_reference.o: types.h xdr.h
  1848. Xxdr_stdio.o: types.h xdr.h
  1849. SHAR_EOF
  1850. if test 3535 -ne "`wc -c < 'rpc/rpclib/Makefile'`"
  1851. then
  1852.     echo shar: "error transmitting 'rpc/rpclib/Makefile'" '(should have been 3535 characters)'
  1853. fi
  1854. chmod 444 'rpc/rpclib/Makefile'
  1855. fi
  1856. exit 0
  1857. #    End of shell archive
  1858.  
  1859.